import 'package:demo/utils/notify.dart';
import 'package:flutter/material.dart';

class Me extends StatefulWidget{
  const Me({Key?key}):super(key:key);
  @override
  State<Me> createState() => _MeState();
}


class _MeState extends State<Me> with TickerProviderStateMixin,AutomaticKeepAliveClientMixin<Me>{
  Color _color = Colors.yellow;
  late AnimationController  _animationController;
  Widget buildWidget(){
    return ValueListenableBuilder(valueListenable:userInfoNotify, builder:(context,value,child){
       return Text("${value.name}");
    });
  }
  setColors(){
    setState(() {
      _color=Colors.blue;
    });
  }
  @override
  void initState() {
    // TODO: implement initState
    _animationController = AnimationController(vsync:this,duration:Duration(seconds:1));

    super.initState();

  }
  @override
  void didChangeDependencies() {
    // TODO: implement didChangeDependencies
    _animationController.forward();
    super.didChangeDependencies();
  }
  @override
  void dispose() {
    // TODO: implement dispose
    _animationController.dispose();
    super.dispose();
  }
  @override
  void updateKeepAlive() {
    // TODO: implement updateKeepAlive

    super.updateKeepAlive();
  }
  Widget build(BuildContext context) {
    print("渲染");
    super.build(context);
    return SafeArea(child:
    LayoutBuilder(builder: (BuildContext context , BoxConstraints boxConstraints ){
      return Center(
        child: Column(

          children: [
            FadeTransition(opacity:_animationController,
              child:Text("我的",style:TextStyle(
                  color:_color
              ),),
            ),
            buildWidget()
          ],
        )
      );
    },

    )
    );
  }

  @override
  // TODO: implement wantKeepAlive
  bool get wantKeepAlive => true;



}

